package hfjava;

public class Books {
    //属性
    private int bookld;
    private String name;
    private String press;
    private double price;

    //方法

    public Books(int bookld, String name, String press,double price) {
        this.bookld = bookld;
        this.name = name;
        this.press = press;
        setPrice(price);
    }
    public void setPrice(double price){
        if (price>0){
            this.price=price;
        }else{
            this.price=0;
        }
    }
    public double getPrice(){
        return price;
    }
    public void shoeInfo(){
        System.out.println(name+"编号为："+bookld+"出版社为："+press+"价格为："+price);
    }

    public static void main(String[] args) {
        Books book=new Books(1,"白雪公主","新华出版社",23.0);
        book.shoeInfo();
    }
}
